﻿<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="Contacts.aspx.cs" Inherits="NEWS.Admin.Contacts" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc2" %>
<asp:Content ID="content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <script type="text/javascript">
        function confirmAction()
         {
            if(confirm('Bạn có chắc chắn muốn xóa???'))
            {
                // you clicked the OK button.
                // you can allow the form to post the data.
                return true;
            }
            else 
                // you clicked the Cancel button.
                // you can disallow the form submission.
                return false;
         }
</script>
<asp:ScriptManager ID="ScriptManager1" runat="server">
                    </asp:ScriptManager>
 <asp:UpdatePanel ID="UpdatePanel1" runat="server" >
     <ContentTemplate>
           <asp:Panel ID="PanelDasboard" runat="server"  Visible="true">
            <div class="dashboard">
                <h2 class="ico_mug">
                    Danh sách liên hệ
                </h2>
                <div>
                    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                        CellPadding="4" DataKeyNames="ContactID"
                        DataSourceID="ObjectDataSource1" Width="100%" 
                        onselectedindexchanged="GridView1_SelectedIndexChanged" AllowPaging="True" 
                        ForeColor="#333333" GridLines="None">
                        <FooterStyle BackColor="#507CD1" ForeColor="White" Font-Bold="True" />
                        <RowStyle BackColor="#EFF3FB" />
                        <Columns>
                            <asp:CommandField ButtonType="Image" SelectImageUrl="~/Admin/img/edit.png" 
                                ShowSelectButton="True" >
                                <ItemStyle Width="50px" />
                            </asp:CommandField>
                            <asp:BoundField DataField="ContactID" HeaderText="Mã liên hệ" ReadOnly="True" 
                                SortExpression="ContactID" InsertVisible="False" >
                            </asp:BoundField>
                            <asp:BoundField DataField="Name" HeaderText="Tên liên hệ" 
                                SortExpression="Name" >
                            </asp:BoundField>
                            <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                            <asp:BoundField DataField="Title" HeaderText="Tiêu đề" SortExpression="Title" />
                            <asp:BoundField DataField="ContactContent" HeaderText="Nội dung liên hệ" 
                                SortExpression="ContactContent" />
                            <asp:BoundField DataField="CreadedDate" HeaderText="CreadedDate" 
                                SortExpression="CreadedDate" DataFormatString = "{0:dd/MM/yyyy}" />
                            <asp:BoundField DataField="UpdatedDate" HeaderText="UpdatedDate" 
                                SortExpression="UpdatedDate" Visible="False" />
                            <asp:TemplateField HeaderText="Kích hoạt">
                                <ItemTemplate>
                                    <asp:CheckBox ID="cbisactive" runat="server" Checked='<%# Eval("IsActive") %>' 
                                        Enabled="False" />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <EditRowStyle BackColor="#2461BF" />
                        <AlternatingRowStyle BackColor="White" />
                    </asp:GridView>
                    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
                        SelectMethod="GetContactBOList" 
                        TypeName="HousingInfo.Library.ContactBOList">
                    </asp:ObjectDataSource>
                    <asp:Label ID="messagedelete" runat="server" Font-Bold="True" Font-Size="Small" 
                        ForeColor="Red"></asp:Label>
                    <br />
                </div>
            </div>
       </asp:Panel>
    <asp:Panel ID="PanelActions" runat="server"  Visible="false">
    <div class="dashboard">
        <h2 class="ico_mug">
            <asp:Label ID="lbHeaderActions" runat="server" Text="Liên hệ"></asp:Label>
        </h2>
       
       
        <div>
            <table style="width: 100%">
                <tr>
                    <td style="width: 132px">
                        &nbsp;</td>
                    <td style="width: 19px">
                        &nbsp;</td>
                    <td>
                        <asp:Label ID="message" runat="server" Font-Bold="True" Font-Size="Small" 
                            ForeColor="Red"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td style="width: 132px; text-align: right;">
                        <asp:Label ID="lblcontactID" runat="server" Text="Mã liên hệ :"></asp:Label>
                    </td>
                    <td style="width: 19px">
                        &nbsp;</td>
                    <td>
                        <asp:TextBox ID="txtcontactid" runat="server" Enabled="False" Width="172px" 
                            ></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td style="width: 132px; text-align: right;">
                        Tên liên hệ :</td>
                    <td style="width: 19px">
                        &nbsp;</td>
                    <td>
                        <asp:TextBox ID="txtname" runat="server" Width="172px" MaxLength="50"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                            ControlToValidate="txtname" ErrorMessage="?"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                            ControlToValidate="txtname" ErrorMessage="Độ dài tối thiểu &gt; 1 và tối đa là 50" 
                            ValidationExpression="^([\S\s]{2,50})$"></asp:RegularExpressionValidator>
                    </td>
                </tr>
                <tr>
                    <td style="width: 132px; text-align: right;">
                        <asp:Label ID="Label3" runat="server" Text="Yahoo :"></asp:Label>
                    </td>
                    <td style="width: 19px">
                        &nbsp;</td>
                    <td>
                        <asp:TextBox ID="txtisyahoo" runat="server" Width="172px" MaxLength="50"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                            ControlToValidate="txtisyahoo" ErrorMessage="?"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                            ControlToValidate="txtisyahoo" ErrorMessage="Độ dài từ 3-50 ký tự" 
                            ValidationExpression="^([\S\s]{3,50})$" Display="Dynamic"></asp:RegularExpressionValidator>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator14" 
                            runat="server" ErrorMessage="Nick Yahoo không hợp lệ" ValidationExpression="\w+([_.]\w+)*" ControlToValidate="txtisyahoo"></asp:RegularExpressionValidator>
                    </td>
                </tr>
                
                <tr>
                    <td style="width: 132px; text-align: right;">
                        <asp:Label ID="Lblskyper" runat="server" Text="Skyper :"></asp:Label>
                    </td>
                    <td style="width: 19px">
                        &nbsp;</td>
                    <td>
                        <asp:TextBox ID="txtisskyer" runat="server" Width="172px" MaxLength="50"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                            ControlToValidate="txtisskyer" ErrorMessage="?"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator7" runat="server" 
                            ControlToValidate="txtisskyer" ErrorMessage="Độ dài từ 3-50 ký tự" 
                            ValidationExpression="^([\S\s]{3,50})$" Display="Dynamic"></asp:RegularExpressionValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator15" 
                            runat="server" ErrorMessage="Nick Skyper không hợp lệ" ValidationExpression="\w+([_.]\w+)*" ControlToValidate="txtisskyer"></asp:RegularExpressionValidator>
                    </td>
                </tr>
                 <tr>
                    <td style="width: 132px; text-align: right;">
                        <asp:Label ID="lblemail" runat="server" Text="Email :"></asp:Label>
                    </td>
                    <td style="width: 19px">
                        &nbsp;</td>
                    <td>
                        <asp:TextBox ID="txtemail" runat="server" Width="172px" MaxLength="50"></asp:TextBox>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator5" runat="server" 
                            ControlToValidate="txtemail" ErrorMessage="Cần nhập đúng định dạng Email" 
                            ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
                    </td>
                </tr>
                
                <tr>
                    <td style="width: 132px; text-align: right;">
                        <asp:Label ID="lbltitle" runat="server" Text="Tiêu đề :"></asp:Label>
                    </td>
                    <td style="width: 19px">
                        &nbsp;</td>
                    <td>
                        <asp:TextBox ID="txttitle" runat="server" Width="172px" MaxLength="50"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                            ControlToValidate="txttitle" ErrorMessage="?"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" 
                            ControlToValidate="txttitle" ErrorMessage="Độ dài tối thiểu &gt; 1 và tối đa là 50" 
                            ValidationExpression="^([\S\s]{2,50})$"></asp:RegularExpressionValidator>
                    </td>
                </tr>
                
                <tr>
                    <td style="width: 132px; text-align: right;">
                        <asp:Label ID="Label1" runat="server" Text="Nội dung liên hệ:"></asp:Label>
                    </td>
                    <td style="width: 19px">
                        &nbsp;</td>
                    <td>
                        <asp:TextBox ID="txtcontactcontent" runat="server" Width="176px" MaxLength="50" 
                            TextMode="MultiLine" ontextchanged="txtcontactcontent_TextChanged"></asp:TextBox>

                    </td>
                </tr>
                
                <tr>
                    <td style="width: 132px; text-align: right;">
                        <asp:Label ID="lblcreateddate" runat="server" Text="Ngày liên hệ: "></asp:Label>
                    </td>
                    <td style="width: 19px">
                        &nbsp;</td>
                    <td>
                        <asp:TextBox ID="txtcreateddate" runat="server" Height="28px" Width="172px" Text='<%# Eval("CreadedDate", "{0:dd/MM/yyyy}") %>'></asp:TextBox>
                       
                    </td>
                </tr>
                <tr>
                    <td style="width: 132px; text-align: right;">
                        <asp:Label ID="lblupdatedate" runat="server" Text="Ngày cập nhật: "></asp:Label>
                    </td>
                    <td style="width: 19px">
                        &nbsp;</td>
                    <td>
                        <asp:TextBox ID="txtupdatedate" runat="server" Height="28px" Width="172px" Text='<%# Eval("UpdatedDate", "{0:dd/MM/yyyy}") %>'></asp:TextBox>
                       
                    </td>
                </tr>
                <tr>
                    <td style="width: 132px; text-align: right;">
                        <asp:Label ID="Label2" runat="server" Text="Is Check :"></asp:Label>
                    </td>
                    <td style="width: 19px">
                        &nbsp;</td>
                    <td>
                        <asp:CheckBox ID="ischeck" runat="server" />
                    </td>
                </tr>
                
                <tr>
                    <td style="width: 132px; text-align: right;">
                        <asp:Label ID="Label10" runat="server" Text="Kích hoạt :"></asp:Label>
                    </td>
                    <td style="width: 19px">
                        &nbsp;</td>
                    <td>
                        <asp:CheckBox ID="isactive" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td style="width: 132px">
                        &nbsp;</td>
                    <td style="width: 19px">
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                </tr>
                <tr>
                    <td style="width: 132px">
                        &nbsp;</td>
                    <td style="width: 19px">
                        &nbsp;</td>
                    <td>
                        <asp:Button ID="btnUpdate" runat="server" Text="Cập nhật" 
                            onclick="btnUpdate_Click" />
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <asp:Button ID="btnDelete" runat="server" onclick="btnDelete_Click"  OnClientClick="javascript:return confirmAction();"
                            Text="Xóa" />
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <asp:Button ID="btnAdd" runat="server" onclick="btnAdd_Click" Text="Thêm" />
                    </td>
                </tr>
            </table>
        </div>
    </div>
     </asp:Panel>
    </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>